package Java201511;

public class CompanyA {
    String name;
    Father[] arr = new Father[4];
    int i =0;

    public CompanyA() {
    }

    public CompanyA(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "CompanyA{" +
                "name='" + name + '\'' +
                '}';
    }
    public void add(Father father){
       arr[i] = father;
       i++;
    }
    public double  getAllSalary(){
        double sum = 0;
        for(Father f : arr){
            //难点:多种类型的员工计算工资的方法不同！
            sum+= f.m();
            //多态↑
        }
        return sum;

    }


}
